<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="config.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
	<script type="text/javascript" src="${ctx}/js/jquery-3.3.1.min.js"></script>
	<script type="text/javascript" src="${ctx}/js/adminEditCommodityInfo.js"></script>
	<link rel="stylesheet" href="${ctx}/css/adminEditCommodityInfo.css" />
</head>
<body>
	<div class="handler4">
		<h3 class="headTitle">商品信息修改</h3>
 		<form id="upFileForm" name="upFileForm" action="editCommodity" method="post" enctype="multipart/form-data"> 
			<table>
				<%
// 					request.setAttribute("adddate", "2019-09-20");
// 					request.setAttribute("name", "戴尔");
				
				%>
				<tr hidden="false"><td><input name="id" value="${commodity.id}"/></td></tr>
				<tr>
					<td class="td1">商品名称：</td>
					<td class="td2"><input name="name" type="text" value="${commodity.name}"/>商品名称3-15字符</td>
				</tr>
				<tr>
					<td class="td1">所属大类：</td>
					<td class="td2">
						<select id="bigType" name="bigType">
							<c:forEach items="${types}" var="type1">
								<c:if test="${type1.pid == 0}">
									<option
										<c:if test="${type1.id==type.id || type1.id==type.pid}">selected</c:if>
									 id="${type1.id}" value="${type1.id}">${type1.name}</option>
								</c:if>
							</c:forEach>
						</select>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 请选择类别
					</td>
				</tr>
				<tr>
					<td class="td1">所属小类：</td>
					<td class="td2"><select id="littleType" name="littleType">
							
							<c:forEach items="${types}" var="type1">
								<c:choose>
									<c:when test="${type.pid == 0}">
										<c:if test="${type.id == type1.pid}">
											<option
												<c:if test="${type1.id==type.id || type1.id==type.pid}">selected</c:if>
											 	id="${type1.id}" value="${type1.id}">${type1.name}
											 </option>
										</c:if>
									</c:when>
									<c:otherwise>
										<c:if test="${type.pid == type1.pid}">
											<option
												<c:if test="${type1.id==type.id || type1.id==type.pid}">selected</c:if>
											 	id="${type1.id}" value="${type1.id}">${type1.name}
											 </option>
										</c:if>
									</c:otherwise>
								</c:choose>
							</c:forEach>
					</select>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 请选择类别</td>
				</tr>
				<tr>
					<td class="td1">商品价格：</td>
					<td class="td2"><input type="text" name="price" value="${commodity.price}"/>带小数的正数，小数点后最多2位。</td>
				</tr>
				<tr>
					<td class="td1">添加时间：</td>
					<td class="td2"><input type="date" name="adddate" value="${commodity.adddate}" /></td>
				</tr>
				<tr>
					<td class="td1">商品图片：</td>
					<td class="td2"><input style="width: 70px; " id="imgComm" type="image" src="
								<c:choose>
									<c:when test="${commodity.imgpath=='' || commodity.imgpath==null}">
										/image/kong.gif
									</c:when>
									<c:otherwise>
										${commodity.imgpath}
									</c:otherwise>
								</c:choose>
								" 
								/>
								<input name="imgpath" hidden="true" value="
								<c:choose>
									<c:when test="${commodity.imgpath=='' || commodity.imgpath==null}">
										/image/null.jpg
									</c:when>
									<c:otherwise>
										${commodity.imgpath}
									</c:otherwise>
								</c:choose>
								" />
					</td>
				</tr>
				<tr>
					<td class="td1" id="reup">重新上传：</td>
					<td class="td2"><input id="upFile" οnchange="changeImge(this)"  type="file" name="file" value="浏览" multiple="multiple" accept="image/jpeg,image/gif,	image/png,image/bmp"/>   后缀允许:jpg,gif,bmp,png</td>
				</tr>
				<tr>
					<td class="td1">商品描述：</td>
					<td class="td2"><textarea rows="5" cols="40" name="describe">${commodity.described}</textarea></td>
				</tr>
				<tr>
					<td class="td1">库存：</td>
					<td class="td2"><input name="num" value="${commodity.num}"/>台 </td>
				</tr>
				<tr>
					<td class="td1"></td>
					<td class="td2" ><button id="sub" type="button">提交</button><button id="reset" type="reset">重置</button><button type="button" id="return" onclick="history.back(-1)">返回</button></td>
				</tr>
			</table>
		</form>
		
	</div>
</body>

</html>